package com.aiju.cash.ui.main.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.aiju.cash.R;

/**
 * 作者：流冥 on 2017/7/19 13:36
 * 说明：
 */

public class CusListView extends LinearLayout {
    private Context mContext;

    public CusListView(Context context) {
        super(context);
        mContext = context;
        initView();
    }

    public CusListView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
        initView();
    }

    public CusListView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mContext = context;
        initView();
    }

    void initView() {
        setOrientation(VERTICAL);

    }

    public void setData(String[] list) {
        if (list.length == 0 || list == null) {
            return;
        }
        for (int i = 0; i < list.length; i++) {
            TextView textView = new TextView(mContext);
            textView.setTextColor(mContext.getResources().getColor(R.color.app_button_color));
            textView.setMaxLines(1);
            textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,12);
            textView.setEllipsize(TextUtils.TruncateAt.END);
            textView.setText("·" + list[i]);
            addView(textView);
        }
    }

}
